<template>
	<div class="user">
		<not-logged v-if="!isSgin"></not-logged>
		<logged v-if="isSgin"></logged>
	</div>
</template>
<script>
	import NotLogged from './NotLogged.vue'
	import Logged from './Logged.vue'
	export default {
		data() {
			return {
				isSgin: false,
			}
		},
		components: {
			NotLogged,
			Logged
		},
		mounted() {
			let obj = {
				user:123,
				token:'5555551'
			}
			this.$request.post('/login', obj).then(res => console.log(res.data))
			//读取本地缓存验证是否已登录
			if (localStorage.getItem('user') != null) {
				if (localStorage.getItem('user').length > 0) {
					this.isSgin = true
				} else {
					this.isSgin = false
				}
			} else {
				this.isSgin = false
			}
		},
		methods: {

		}
	}
</script>
<style lang="scss" scoped>
	.user {
		background-color: #ffffff;
	}
</style>
